package com.mq.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.mq.service.MQExchangeDirectService;
import com.mq.service.MQExchangeFanoutConfirmBackService;
import com.mq.service.MQExchangeFanoutService;
import com.mq.service.MQExchangeTopicService;
import com.mq.service.MQSimpleService;
import com.mq.vo.QaAuditReqVO;

/**
 * 问题审核
 * @author Administrator
 *
 */
@Configuration
@RestController
public class QaAuditController {
	@Autowired
	RabbitTemplate rabbitTemplate;
	@Autowired
	MessageConverter messageConverter;
	@Autowired
	MQSimpleService mqSimpleService;
	@Autowired
	MQExchangeFanoutService mQExchangeFanoutService;
	@Autowired
	MQExchangeDirectService mqExchangeDirectService;
	@Autowired
	MQExchangeTopicService mqExchangeTopicService;
	@Autowired
	MQExchangeFanoutConfirmBackService mqExchangeFanoutConfirmBackService;

	@RequestMapping("/send")
	public String sendQaAudit(QaAuditReqVO qaAuditReqVO) {
		   //发送一个简单消息,work消息模式
		   //mqSimpleService.sendSimple(qaAuditReqVO);
		   
		   //发送一个发布者与订阅模式，或者扇形交换器消息
			//mQExchangeFanoutService.send(qaAuditReqVO);
		   
		    //发送一个直连交换器，路由模式
			//mqExchangeDirectService.send(qaAuditReqVO);
		   
			//发送一个topic模式
			//mqExchangeTopicService.send(qaAuditReqVO);
		
		   //发送确认消息业务
		  mqExchangeFanoutConfirmBackService.send(qaAuditReqVO);
		 
		   return "发送成功";
	}
	
}
